const username: string = "xiaowang"

//自定义一种数据类型
type myUser = {
    id: number,
    name: string
}

//数组中只能存放number数据类型
const array: number[] = [1, 2, 3]
const array2: string[] = ["xiaowang"]
//自定义类型
const array3: myUser[] = [{ id: 1, name: "xiaowang" }]

console.log(array3[0].id);

/**
 * 元组
 */

let users: [number, string, string] = [1, "xiaowang", "武侯区"]
console.log(users[0]);

/**
 * 枚举
 */
enum state {
    error = 0,  //支付失败
    succcess = 1,
    fail = 2,  //支付超时
    timeout = 3
}
const order = {
    name: "小米耳机",
    price: 199,
    state: 1
}

if (order.state === state.error) {

}else if(order.state == state.succcess){

}else if(order.state == state.fail){

}

/**
 * undefined和null
 */
let male:number | undefined;
male = 1
let address:string | null
address = null

let age:number | boolean | string | undefined;
age = true

/**
 * Object表示三种格式
 * 
 */
let user:object = [1,2,3]
let user2:object = {id:1}
let user3:object = function(){}
// console.log(user2.id);

// 具体要表示出 对象属性
let user4:{id:number,name:string,address?:string} = {id:1,name:"xiaowang"}


/**
 * any类型
 */
let studentName:any = "xiaowang"
studentName = 1
studentName = true

let student:any = {
    id:1
}
console.log(student.id);
console.log(student.name);

const box:any = document.getElementById("app")






//让我们代码编译为模块化代码
export { }